#include"namePipe.hpp"
using namespace bit;

//客户端发消息：注意客户端进程要先起！
int main()
{
    NamedPipe_Write pipe;
    int cnt = 0;
    while(true)
    {
        #ifdef v1
        std::string mes("I am client process. my pid: ");
        mes += std::to_string(getpid());
        mes += " messageId: " + std::to_string(++cnt);
        pipe.Write(mes);
        sleep(1);
        if(cnt == 10) break;
        #endif
        #ifdef v2
        std::string mes;
        std::cout << "Please Enter->";
        std::getline(std::cin, mes);
        pipe.Write(mes);
        #endif
    }
    return 0;
}